<?php /* Smarty version Smarty-3.1.13, created on 2013-12-27 16:54:19
         compiled from "G:\phpserver\ibo123\templates\admin\posts\postcomments.tpl" */ ?>
<?php /*%%SmartyHeaderCode:19675529def0d055909-90259167%%*/if(!defined('SMARTY_DIR')) exit('no direct access allowed');
$_valid = $_smarty_tpl->decodeProperties(array (
  'file_dependency' => 
  array (
    'd8a38a89c473baee01c804846e95991c1f730467' => 
    array (
      0 => 'G:\\phpserver\\ibo123\\templates\\admin\\posts\\postcomments.tpl',
      1 => 1387876141,
      2 => 'file',
    ),
  ),
  'nocache_hash' => '19675529def0d055909-90259167',
  'function' => 
  array (
  ),
  'version' => 'Smarty-3.1.13',
  'unifunc' => 'content_529def0d15b8c3_37282969',
  'has_nocache_code' => false,
),false); /*/%%SmartyHeaderCode%%*/?>
<?php if ($_valid && !is_callable('content_529def0d15b8c3_37282969')) {function content_529def0d15b8c3_37282969($_smarty_tpl) {?><?php echo $_smarty_tpl->getSubTemplate ("admin/header.tpl", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, null, null, array(), 0);?>
 <?php echo $_smarty_tpl->getSubTemplate ("admin/navibar.tpl", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, null, null, array(), 0);?>
 <?php echo $_smarty_tpl->getSubTemplate ("admin/sidebar.tpl", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, null, null, array(), 0);?>

<style>
#checkStatus_myModal {
	margin: -300px 0 0 -500px;
	/* PLAY THE WITH THE VALUES TO SEE GET THE DESIRED EFFECT */
}
</style>
<div class="content">
	<div class="header">
		<div class="stats">
			<p class="stat">
				<!--span class="number"></span-->
			</p>
		</div>

		<h3 class="page-title">文章评论管理</h3>
	</div>


	<div class="container-fluid">
		<div class="row-fluid">
			<div class="block">
				<div id="page-menu" class="block-body collapse in">
					<br />
					<form class="form-search" method="post" id="searchform">
						<div class="input-prepend">
							<span class="add-on">状态</span> <select type="text"
								placeholder="状态" name="comment_approved" id="comment_approved"
								style="width: 135px;">
								<option value="0">已批准</option>
								<option value="1">未审核</option>
							</select>
						</div>
						<div class="input-prepend">
							<span class="add-on">开始时间:</span> <input class="input-medium"
								type="text" placeholder="评论开始时间点" name="comment_start_date"
								id="comment_start_date" style="width: 135px;">
						</div>
						<div class="input-prepend">
							<span class="add-on">结束时间:</span> <input class="input-medium"
								type="text" placeholder="评论结束时间点" name="comment_end_date"
								id="comment_end_date" style="width: 135px;">
						</div>

						<button type="button" class="btn btn-primary" onclick="search()">查询</button>
						<button type="button" class="btn " onclick="clearSearch()">重置</button>
					</form>
				</div>
			</div>
		</div>
		<div class="block">

			<table id="grid"
				data-options="url:'admin/postComments/getpage',fitColumns:true,singleSelect:true,"
				class="easyui-datagrid" style="width: auto; height: 350px"
				iconCls="icon-save" pagination="true"　>
				<thead>
					<tr>
						<!-- 						<th data-options="field:'user_id',hidden:true,width:100"></th> -->
						<!-- 					<th data-options="field:'comment_post_id',hidden:true,width:100"></th> -->

						<th data-options="field:'comment_post_id',hidden:true,width:100"></th>
						<th data-options="field:'post_title',width:100">文章标题</th>
						<th data-options="field:'comment_author_IP',width:100">评论IP</th>
						<th data-options="field:'comment_date',width:100">评论时间</th>
						<th data-options="field:'comment_content',width:100">评论正文</th>
						<th
							data-options="field:'comment_approved',width:100,formatter:comment_approvedtypeformat">审核状态</th>
						<th data-options="field:'comment_agent',width:100">评论者</th>
						<th data-options="field:'comment_parent',width:120">父评论</th>
						<th data-options="field:'username',width:100">评论者</th>

						<th
							data-options="field:'comment_ID',width:100,formatter:editformatter">操作</th>
					</tr>
				</thead>
			</table>


			<!--- END --->
		</div>

		<div id="checkStatus_myModal" class="modal hide fade">
			<div class="modal-header">
				<button type="button" class="close" data-dismiss="modal"
					aria-hidden="true">&times;</button>
				<h3>在线设备管理</h3>
			</div>
			<div class="modal-body" align="center">
				<button class="btn   btn-primary" onclick="pass()"
					style="width: 135px">通过</button>
				<button style="width: 135px" onclick="unpass()"
					class="btn  btn-inverse">不通过</button>
			</div>
		</div>


	</div>


	<!--- END 以下内容不需更改，请保证该TPL页内的标签匹配即可 --->
	<?php echo $_smarty_tpl->getSubTemplate ("admin/footer.tpl", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, null, null, array(), 0);?>


	<script type="text/javascript"
		src="<?php echo @constant('WEBSITE_URL');?>
public/js/rmanger.js"></script>
	<script type="text/javascript">
        var weburl = '<?php echo @constant('WEBSITE_URL');?>
';
        var url = weburl+"admin/postComments";
        var key = "comment_ID";

	$('#grid').datagrid({
		 onClickRow:function(index){ //暂时只是到用这种方式去改变选中一行是的背景颜色
		   	 $('.datagrid-row').removeClass('datagrid-row-selected').css({background:"",color:""});
		   	 $('#datagrid-row-r1-2-'+index).addClass('datagrid-row-selected').css({background:'#FBEC88',color:'#333333'});
		   }
	});
	
	$('#comment_start_date').datepicker( {dateFormat:'yy-mm-dd'});
	$('#comment_end_date').datepicker( {dateFormat:'yy-mm-dd'});

	function editformatter(value,row,index){
		
		//return "<a href='<?php echo @constant('WEBSITE_URL');?>
Logerrormsg/getLogErrorMsg?deviceid="+value+"'> 下载 </a>"; 
		return "<a onclick=deleteCurtem('"+value+"'); deviceid='"+value+"' href='javascript:void(0);'> 删除 </a>"+ "<a onclick=pass('"+value+"'); deviceid='"+value+"' href='javascript:void(0);'> 通过 </a>"+
		"<a onclick=unpass('"+value+"'); deviceid='"+value+"' href='javascript:void(0);'> 不通过</a>";
	}
	
	
	/**
	评论审核
	*/
	function checkComments(){
		var select = getSelectItem();
		if(select == null || select.length == 0 ){
			$.messager.alert('错误','请选择要编辑的记录!');
			return;
		}
		model("checkStatus_myModal",0);
	}
	function pass(value){
		$.ajax({  
            type: "POST",  
            dataType: "json",  
            url: url+'/check',
            data: { id:value,check:0 },  
            success: function (data) {  
             	$('#'+grid).datagrid('reload',param); 
            },  
            error: function () {  
            }  
        });  
		model("checkStatus_myModal",1);
	}

	function deleteCurtem(value){
		$.messager.confirm('删除确定','确定要删除当前选择的记录!',function(r){
		    if (r){
		    	 
				$.ajax({  
		            type: "POST",  
		            dataType: "json",  
		            url: url+'/delete',
		            data: { id: value },  
		            success: function (data) {  
		             	$('#'+grid).datagrid('reload',param); 
		            },  
		            error: function () {  
		            }  
		        });  
		    }
		});
	}
	function unpass(value){
		$.ajax({  
            type: "POST",  
            dataType: "json",  
            url: url+'/check',
            data: { id: value,check:1},  
            success: function (data) {  
             	$('#'+grid).datagrid('reload',param); 
            },  
            error: function () {  
            }  
        });  
		model("checkStatus_myModal",1);
	}
  function  dateTimeFormat(value, rec, index) {
    if (value == undefined) {
        return "";
    }
    return value.format("yyyy-mm-dd");
}

	function  comment_approvedtypeformat(value,row,index){
		if(value == 0){
			return "已批准"; 
		}else if(value == 1){
			return "未审核"; 
		}
		  return "";
	}
	var Common = {
	    //EasyUI用DataGrid用日期格式化
	    TimeFormatter: function (value, rec, index) {
	        if (value == undefined) {
	            return "";
	        }
	        /*json格式时间转js时间格式*/
	        value = value.substr(1, value.length - 2);
	        var obj = eval('(' + "{Date: new " + value + "}" + ')');
	        var dateValue = obj["Date"];
	        if (dateValue.getFullYear() < 1900) {
	            return "";
	        }
	        var val = dateValue.format("yyyy-mm-dd HH:MM");
	        return val.substr(11, 5);
	    },
	    DateTimeFormatter: function (value, rec, index) {
	        if (value == undefined) {
	            return "";
	        }
	        /*json格式时间转js时间格式*/
	        value = value.substr(1, value.length - 2);
	        var obj = eval('(' + "{Date: new " + value + "}" + ')');
	        var dateValue = obj["Date"];
	        if (dateValue.getFullYear() < 1900) {
	            return "";
	        }

	        return dateValue.format("yyyy-mm-dd HH:MM");
	    },

	    //EasyUI用DataGrid用日期格式化
	    DateFormatter: function (value, rec, index) {
	        if (value == undefined) {
	            return "";
	        }
	        /*json格式时间转js时间格式*/
	        value = value.substr(1, value.length - 2);
	        var obj = eval('(' + "{Date: new " + value + "}" + ')');
	        var dateValue = obj["Date"];
	        if (dateValue.getFullYear() < 1900) {
	            return "";
	        }

	        return dateValue.format("yyyy-mm-dd");
	    }
	};
</script><?php }} ?>